<h2><?=$mycompany->company_name;?></h2>

<div class="block tabs spaces">
	<div class="hd">
		<ul>
			<li><a>Departments</a></li>
			<li><a href="<?=site_url('users');?>">People</a></li>
		</ul>
		<div class="clear"></div>
	</div>
	
	<div class="bd">

<?php if ($departments):?>
	<table>
		<thead>
			<td>Department</td>
			<td>Rate</td>
			<td>Users</td>
			<td>Number of jobs</td>
			<td>&nbsp;</td>
		</thead>
		
		<tbody>
			<?php foreach($departments as $department):?>
			<tr>
				<td><strong><span class="edit_textinput" id="<?=$department->id;?>|costcenter|centertitle"><?=$department->centertitle;?></span></strong></td>
				<td>&pound;<span class="edit_textinput" id="<?=$department->id;?>|costcenter|hourlyrate"><?=$department->hourlyrate;?></span> / hr</td>
				<td><span><?php if ($department->users):?><?=count($department->users);?><?php else:?>0<?php endif;?></span></td>
				<td><span><?php if ($department->jobs):?><?=count($department->jobs);?><?php else:?>0<?php endif;?></span></td>
				<td><a class="destroy" href="">Delete</a></td>
			</tr>
			<?php endforeach;?>
		</tbody>
	</table>
	
	</ul>
<?php else:?>
	<p>You can add departments to your company to track time and updates against it.</p>
<?php endif;?>
	
	
	</div>
</div>

</div>
</div>
</div>

<div id="sidebar" class="yui-b">
		<div class="block">
			<div class="hd">
				<h2>Add a new department</h2>
			</div>
			<div class="bd">
				<?=form_open('users/adddepartment', array('class' => 'formhelper') );?>
				<fieldset>
					<p><label for="centertitle">Department Name</label>
					<input class="text" type="text" name="centertitle" /></p>
					
					<p><label>Hourly Rate</label>
					<input class="text" type="text" name="hourlyrate" /></p>
				</fieldset>
				
				<input type="submit" name="Submit" value="Save" class="submit">

				<?=form_close();?>
			</div>
		</div>
</div>